








//
//  NGovReceivedProblemFBViewController.m
//  nncloud
//
//  Created by macfai on 2018/9/20.
//  Copyright © 2018年 youedata. All rights reserved.
//

#import "NGovReceivedProblemFBViewController.h"
#import "ZJScrollPageView.h"
#import "NGovFBChildViewController.h"

@interface NGovReceivedProblemFBViewController ()<ZJScrollPageViewDelegate>

/**
 页面分栏的标题
 */
@property (strong,nonatomic) NSArray<NSString *>*titles;

/**
 横向分页滑动组件
 */
@property (strong,nonatomic) ZJScrollPageView *scrollPageView;



@end

@implementation NGovReceivedProblemFBViewController


- (void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    NSInteger index = [NUserModel shareInstance].index;
    switch (index) {
        case 0:
        {
             [_scrollPageView setSelectedIndex:0 animated:NO];
        }
            break;
            
        case 1:
        {
             [_scrollPageView setSelectedIndex:1 animated:NO];
        }
            break;
        case 2:
        {
             [_scrollPageView setSelectedIndex:2 animated:NO];
        }
            break;
        default:
            break;
    }
}

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.view.backgroundColor = kWhiteColor;
    [self.navigationItem setItemWithTitle:@"问题反馈" textColor:kNavigationTitleColor fontSize:18 itemType:center];
    // Do any additional setup after loading the view from its
    ZJSegmentStyle *style = [[ZJSegmentStyle alloc] init];
    //显示滚动条
    style.showLine = YES;
    // 颜色渐变
    style.gradualChangeTitleColor = YES;
    style.scrollTitle = NO;
    style.scrollLineColor = NColorFrom16RGB(0x23b7e5);
    style.selectedTitleColor = NColorFrom16RGB(0x23b7e5);
    style.segmentViewBounces = YES;
    style.titleFont = kFont15;
    style.adjustCoverOrLineWidth = YES;
    style.autoAdjustTitlesWidth = NO;
    style.segmentHeight = 30;
    self.titles = @[@"处理中",
                    @"待处理",
                    @"已处理"];
    // 初始化
    _scrollPageView = [[ZJScrollPageView alloc] initWithFrame:CGRectMake(0, 10, ScreenWidth, ScreenHeight - 20.0) segmentStyle:style titles:self.titles parentViewController:self delegate:self];
    [self.view addSubview:_scrollPageView];
    self.view.backgroundColor = kWhiteColor;
}

#pragma mark ZJPhotoScrollViewDelegate
- (NSInteger)numberOfChildViewControllers {
    return self.titles.count;
}

- (UIViewController<ZJScrollPageViewChildVcDelegate> *)childViewController:(UIViewController<ZJScrollPageViewChildVcDelegate> *)reuseViewController forIndex:(NSInteger)index {
    
    UIViewController<ZJScrollPageViewChildVcDelegate> *childVc = reuseViewController;
    
    if (!childVc) {
        
        childVc = [[NGovFBChildViewController alloc] init];
        
    }
    return childVc;
}

- (BOOL)shouldAutomaticallyForwardAppearanceMethods{
    return NO;
}

@end
